<?php
$this->template->add_css_lib("myscorespresenter.css");
echo $this->template->add_js("play_game.js");
echo $this->template->add_js("lights.js");
?>
<div id="content_game">
<div class="breadcrumb breadcrumbs">
	<div class="rdfa-breadcrumb">
		<div xmlns:v="http://rdf.data-vocabulary.org/#">
			<div>
				<span class="breadcrumbs-title"> </span>
				<span typeof="v:Breadcrumb"><a rel="v:url" property="v:title" href="http://gamehaynhat.com/" class="home">Home</a></span>
				<span class="separator">></span> 
				<?php if (isset($parent_cate) && $parent_cate) { ?>
				<span typeof="v:Breadcrumb"><a rel="v:url" property="v:title" href="<?php echo category_url($parent_cate->cat_code);?>" title="<?php echo $parent_cate->cat_name;?>"><?php echo $parent_cate->cat_name;?></a></span> 
					<span class="separator">></span> 
				<?php } ?> 
			
				<?php if (isset($cate) && $cate) { ?>
					<span typeof="v:Breadcrumb"><a rel="v:url" property="v:title" href="<?php echo category_url($cate->cat_code);?>" title="<?php echo $cate->cat_name;?>"><?php echo $cate->cat_name;?></a></span> 
				<?php } ?> 
			<span class="separator">></span> <?php echo $game->game_title; ?></div>
		</div>
	</div>
</div>

  
  
<div class="clear" style="height:10px"></div>
<!-------------->
<div style="min-height: 455px;">
<h1 class="game_title_h1"><?php echo $game->game_title; ?></h1>
  <div id="intro"> <img src="<?php echo $this->template->url_theme;?>images/logoplay.png" />
    <div id="showprogressbar" style="display:block; margin:0px;">
      <div id="progressbar" style="margin-left: 146px;"> <span id="progresstext">0%</span>
        <div id="progressbarloadbg" style="z-index: 2; transition: width 5s;">&thinsp;</div>
      </div>
    </div>
    <div id="progressbarloadtext" onclick="window.hide();"> Tải game hoàn tất, chơi game ngay! </div>
  </div>
  <div class="clear"></div>
<?php
	$flash_height = $game->game_file_rate_height_width*670;
	if(in_array($game->game_id,array(1586,1589, 1643)))
	{
		$flash_height =515;
		?>
		<?php
	}
	$game_file = $this->sserver->balancing_file($game->game_file);
	//$game_file =image_src($game->game_file );
?>
  <div id="my_game" style="height: 100%; width: 100%; display: none;">
    <div id="escenario">
      <div id="play_game" style="width: 670px; height: <?php echo $flash_height;?>px">
        <div id="bordeswf">
		  <object id="playgame" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="670" height="<?php echo $flash_height;?>" id="preloader" align="middle"><param name="movie" value="<?php echo $game_file; ?>"><param name="quality" value="high"><param name="wmode" value="transparent"><param name="allowScriptAccess" value="always"><param name="allowFullScreen" value="true"><param name="bgcolor" value="#ffffff"><param name="flashvars" value=""><embed src="<?php echo $game_file; ?>" id="play_game" quality="high" type="application/x-shockwave-flash" wmode="transparent" pluginspage="http://www.macromedia.com/go/getflashplayer/" width="670" height="<?php echo $flash_height;?>" name="preloader" align="middle" allowScriptAccess="always" allowFullScreen="true" flashVars=""></object>
		  
        </div>
      </div>
      <div id="game_buttons"> <a href="javascript:void(0)" id="replay_game" class="choilai">Chơi lại</a> <span class="molon" id="game_out" ><a href="javascript:void(0)" onclick="javascript:change_screen_game_player(0);">Mở lớn</a></span> <span id="game_in" class="thunho" ><a href="javascript:void(0)" onclick="javascript:change_screen_game_player(1);">Thu nhỏ</a></span> <a href="#" title="Tắt/mở nền" class="interruptor"><img src="<?php echo $this->template->url_theme;?>images/blank.png" border="0" alt="Lights Toggle"> Tắt/mở nền</a> <a href="javascript:void(0);" onclick=content"javascript:AccountInteractiveToGamePlayer('failure_update');" title="Báo lỗi game" class="baoloi">Báo lỗi</a>
        <?php if (is_module_active('user_game_favorites_module') &&  function_exists('run_widget')) run_widget('user_game_favorites_module', array(
				'view'=> 'add',
				'game_id'=> $game->game_id,
			)); ?>
        <?php //			<a class="thachdau">Thách đấu</a> ?>
      </div>
      <div class="clear"></div>
    </div>
  </div>
</div>
</div>









 
	
	
		
<script>
<?php if($msg !='') {
	echo 'alert("'.$msg.'");';
} ?>
</script> 
<script type="text/javascript">
function change_screen_game_player(pid) {
	$("#game_out").click(function() {
		embed = $('#playgame').animate();
		embed_ie = $('#playgame_ie').animate();
		var max_width = 800;
		var ar = embed.width()/embed.height(); 
		var new_height= ($('#playgame embed').attr('height') *max_width)/$('#playgame embed').attr('width');
		var ar_ie = embed_ie.width()/embed_ie.height(); 
		$('#playgame').attr('width', max_width);
		$('#playgame embed').attr('width', max_width);
		$('#playgame embed').attr('height', new_height);
		$('#play_game').css('height', new_height);
		$('#play_game').css('padding-left', 90);
		//$('#play_game').css('height', max_width/ar);
		// Xu ly mo rong tren IE
		$('#playgame_ie').attr('width', max_width);
		$('#playgame_ie').attr('height', max_width/ar_ie);
		
		$("#content_game").attr("id", "content_game-full");
		//$('.centerBox-o-c-gamePage-gameplay').attr("class", "centerBox-o-c-gamePage-gameplay-full-1004");
		$('#game_out').hide();
		$('#game_in').show();
	});
	$("#game_in").click(function() {
		//var v_width = $("#hnd_width").val();
		embed = $('#playgame').animate();
		var max_width = 670;
		var ar = embed.width()/embed.height(); 
		var ar_ie = embed_ie.width()/embed_ie.height(); 
		var new_height= ($('#playgame embed').attr('height') *max_width)/$('#playgame embed').attr('width');
		
		$('#play_game').css('width', max_width);
		//$('#play_game').attr('height', max_width/ar);
		$('#playgame').attr('width', max_width);
		$('#playgame embed').attr('width', max_width);
		$('#playgame embed').attr('height', new_height);
		$('#play_game').css('height', new_height);
		$('#play_game').css('padding-left', 0);
		// Xu ly thu nho tren IE
		$('#playgame_ie').attr('width', max_width);
		$('#playgame_ie').attr('height', max_width/ar_ie);
		
		$("#content_game-full").attr("id", "content_game");
		//$('.centerBox-o-c-gamePage-gameplay-full-1004').attr("class", "centerBox-o-c-gamePage-gameplay");
		$('#game_out').show();
		$('#game_in').hide();
	});
}
<?php if(in_array($game->game_id,array(1586,1589, 1643))) 
	{
		?>
		$('#play_game').attr('width', 800);
		$('#play_game').css('width', 800);
		$('#play_game').css('margin', '0 auto');
		$('#play_game embed').attr('width', 800);
		$('#showprogressbar').css('margin-left', 150);
		$("#content_game").attr("id", "content_game-full");
		<?php
	} ?>
</script>
<style>
#content-main {
width: 100%;
}
</style>